home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg4.cab / test_dl.py < prev    next >
Text File  |  2005-11-19  |  745b  |  34 lines

  1. #! /usr/bin/env python
  2. """Test dlmodule.c
  3.    Roger E. Masse  revised strategy by Barry Warsaw
  4. """
  5.  
  6. import dl
  7. from test.test_support import verbose,TestSkipped
  8.  
  9. sharedlibs = [
  10.     ('/usr/lib/libc.so', 'getpid'),
  11.     ('/lib/libc.so.6', 'getpid'),
  12.     ('/usr/bin/cygwin1.dll', 'getpid'),
  13.     ]
  14.  
  15. for s, func in sharedlibs:
  16.     try:
  17.         if verbose:
  18.             print 'trying to open:', s,
  19.         l = dl.open(s)
  20.     except dl.error, err:
  21.         if verbose:
  22.             print 'failed', repr(str(err))
  23.         pass
  24.     else:
  25.         if verbose:
  26.             print 'succeeded...',
  27.         l.call(func)
  28.         l.close()
  29.         if verbose:
  30.             print 'worked!'
  31.         break
  32. else:
  33.     raise TestSkipped, 'Could not open any shared libraries'
  34.